//
//  ResponseModel.swift
//  App
//
//  Created by 汤泽川 on 2019/3/26.
//

import Foundation
import Vapor

public final class ResponseModel<T> : Content where T : Content {
    var status : Int
    var message : String
    var data : T?
    init(_ status : Int, _ message : String) {
        self.status = status
        self.message = message
    }
    static func successResponse() -> ResponseModel<String> {
        return ResponseModel<String>(0, "成功")
    }
    static func successResponse(_ data : T) -> ResponseModel<T> {
        let response = ResponseModel<T>(0, "成功")
        response.data = data
        return response
    }
}
